package cn.butcher21.utils;

import cn.butcher21.pojo.SaleData;
import cn.butcher21.print.Goods;

import java.util.ArrayList;
import java.util.List;

/**
 * butcher create in 2021/05/06/19:25
 */
public class ToPrintList {
    public static List<Goods> format(List<SaleData> list) {
        List<Goods> goodsList = new ArrayList<Goods>();
        for (SaleData goods : list) {
            Goods goods1 = new Goods();
            goods1.setGname(goods.getName());
            goods1.setNum(String.valueOf(goods.getCount()));
            goods1.setPrice(String.valueOf(goods.getPrice()));
            goods1.setTotal(String.valueOf(goods.getCount() * goods.getPrice()));
            goodsList.add(goods1);
        }
        return goodsList;
    }
}
